package com.Txunda.fxw.ui.activity.other;

import com.Txunda.fxw.R;
import com.Txunda.fxw.ui.base.BaseAty;
import com.Txunda.fxw.ui.toolkit.util.DataClean;
import com.Txunda.fxw.view.dialog.AlertDialog;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
/**
 * 设置界面
 * @author Administrator
 *
 */
public class SettingAty extends BaseAty {

	@ViewInject(R.id.aty_title3_tv_center)
	private TextView aty_title3_tv_center;
	@ViewInject(R.id.tv_data_number)
	private TextView tv_data_number;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	protected int getLayoutResId() {
		return R.layout.aty_setting_aty;
	}
	
	@Override
	@OnClick({R.id.tv_clear_cache,R.id.tv_hotLine,R.id.tv_aboutUs})
	public void onClick(View v) {
		super.onClick(v);
		switch (v.getId()) {
		case R.id.tv_clear_cache:  //清除缓存
			try {
				new AlertDialog(this).builder().setTitle("提示").setMsg("确定要清除缓存?")
				.setPositiveButton("确定", new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						try {
							DataClean.clearAllCache(SettingAty.this);
							tv_data_number.setText(0+"k");
						} catch (Exception e) {
							e.printStackTrace();
						}
						
						
					}
				}).setNegativeButton("取消", new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						
					}
				}).show();
				
			} catch (NullPointerException e) {
				e.printStackTrace();
			}
			break;
		case R.id.tv_hotLine:  //客服热线
			startActivity(HotLineAty.class, null);
			break;
		
		case R.id.tv_aboutUs:   //关于我们
			startActivity(AboutUsAty.class,null);
			break;
		

		default:
			break;
		}
	}

	@Override
	protected void initialized() {
		aty_title3_tv_center.setText("设置");
		//显示缓存大小
		try {
			tv_data_number.setText(DataClean.getTotalCacheSize(SettingAty.this));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	protected void requestData() {
		
	}

	
}
